/*   time:2019-06-13 20:39:23*/
function t(t, a, e) {
    return a in t ? Object.defineProperty(t, a, {
        value: e,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : t[a] = e, t
}
var a, e, i = getApp(),
    s = i.requirejs("core"),
    o = i.requirejs("wxParse/wxParse"),
    n = i.requirejs("biz/diypage"),
    r = i.requirejs("biz/diyform"),
    d = i.requirejs("biz/goodspicker"),
    u = (i.requirejs("foxui"), i.requirejs("jquery"));
Page((t(e = {
    data: (a = {
        imgUrls: ["https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509963648306&di=1194f5980cccf9e5ad558dfb18e895ab&imgtype=0&src=http%3A%2F%2Fd.hiphotos.baidu.com%2Fzhidao%2Fpic%2Fitem%2F9c16fdfaaf51f3de87bbdad39ceef01f3a29797f.jpg", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509963737453&di=b1472a710a2c9ba30808fd6823b16feb&imgtype=0&src=http%3A%2F%2Fwww.qqzhi.com%2Fwenwen%2Fuploads%2Fpic.wenwen.soso.com%2Fp%2F20160830%2F20160830220016-586751007.jpg", "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3004162400,3684436606&fm=11&gp=0.jpg"],
        indicatorDotss: !0,
        autoplays: !0,
        intervals: 2e3,
        durations: 500,
        circulars: !0,
        adveradmin: !0,
        clock: "",
        diypage: "true",
        route: "custom",
        icons: i.requirejs("icons"),
        shop: {},
        indicatorDots: !0,
        autoplay: !0,
        interval: 5e3,
        duration: 500,
        circular: !0,
        storeRecommand: [],
        total: 1,
        page: 1,
        loaded: !1,
        loading: !0,
        indicatorDotsHot: !1,
        autoplayHot: !0,
        intervalHot: 5e3,
        durationHOt: 1e3,
        circularHot: !0,
        hotimg: "http://qcoe22giq.bkt.clouddn.com/static/images/hotdot.jpg",
        notification: "http://qcoe22giq.bkt.clouddn.com/static/images/notification.png",
        saleout1: "http://qcoe22giq.bkt.clouddn.com/static/images/saleout-1.png",
        saleout2: "http://qcoe22giq.bkt.clouddn.com/static/images/saleout-2.png",
        saleout3: "http://qcoe22giq.bkt.clouddn.com/static/images/saleout-3.png",
        play: "http://qcoe22giq.bkt.clouddn.com/static/images/video_play.png",
        mute: "http://qcoe22giq.bkt.clouddn.com/static/images/icon/mute.png",
        voice: "http://qcoe22giq.bkt.clouddn.com/static/images/icon/voice.png",
        specs: [],
        options: [],
        diyform: {},
        specsTitle: ""
    }, t(a, "total", 1), t(a, "active", ""), t(a, "slider", ""), t(a, "tempname", ""), t(a, "buyType", ""), t(a, "areas", []), t(a, "closeBtn", !1), t(a, "soundpic", !0), t(a, "modelShow", !1), t(a, "limits", !0), t(a, "result", {}), t(a, "audios", {}), t(a, "audiosObj", {}), t(a, "picture", {}), t(a, "result", {}), t(a, "pageid", 0), a),
    onShow: function() {
        var e = this,
            t = wx.getSystemInfoSync(),
            a = e.data.pageid;
        s.get("diypage&id=" + a, {}, function(t) {
            var a = {
                loading: !1,
                diypage: t.diypage
            };
            e.setData(a)
        }), e.setData({
            screenWidth: t.windowWidth
        })
    },
    onLoad: function(t) {
        t = t || {};
        var d = this;
        d.pauseOther();
        var a = t.pageid;
        if (null == a) {
            var e = getCurrentPages(),
                o = e[e.length - 1].route.split("/");
            a = o[o.length - 1]
        }
        d.setData({
            pageid: a,
            imgUrl: i.globalData.approot
        });
        var r = decodeURIComponent(t.scene);
        if (!t.id && r) {
            var u = s.str2Obj(r);
            t.id = u.id, u.mid && (t.mid = u.mid)
        }
        setTimeout(function() {
            d.setData({
                areas: i.getCache("cacheset").areas
            })
        }, 3e3), i.url(t), n.get(this, a, function(t) {
            if (null != d.data.startadv && "" != d.data.startadv) {
                0 != d.data.startadv.status && "" != d.data.startadv || wx.getSetting({
                    success: function(t) {
                        t.authSetting["scope.userInfo"]
                    }
                });
                var a = d.data.startadv.params;
                if ("default" == a.style) {
                    var e = a.autoclose;
                    ! function t(a) {
                        d.setData({
                            clock: e
                        }), e <= 0 ? d.setData({
                            adveradmin: !1
                        }) : setTimeout(function() {
                            e -= 1, t(a)
                        }, 1e3)
                    }(d)
                }
                if (1 == a.showtype) {
                    var s = 1e3 * a.showtime * 60,
                        n = i.getCache("startadvtime"),
                        o = +new Date,
                        r = !0;
                    d.setData({
                        adveradmin: !0
                    }), n && o - n < s && (r = !1), d.setData({
                        adveradmin: r
                    }), r && i.setCache("startadvtime", o)
                }
                d.data.startadv.status
            }
        }), d.setData({
            cover: !0,
            showvideo: !1
        }), wx.getSystemInfo({
            success: function(t) {
                var a = t.windowWidth / 1.7;
                d.setData({
                    swiperheight: a
                })
            }
        })
    },
    getShop: function() {
        var a = this;
        s.get("shop/get_shopindex", {}, function(t) {
            o.wxParse("wxParseData", "html", t.copyright, a, "5"), a.setData({
                shop: t
            })
        })
    },
    onReachBottom: function() {
        this.data.loaded || this.data.storeRecommand.length == this.data.total || this.getRecommand()
    },
    getRecommand: function() {
        var e = this;
        "true" != e.data.diypage && s.get("shop/get_recommand", {
            page: e.data.page
        }, function(t) {
            var a = {
                loading: !1,
                total: t.total
            };
            e.setData({
                loading: !1,
                total: t.total,
                show: !0
            }), t.list || (t.list = []), 0 < t.list.length && (e.setData({
                storeRecommand: e.data.storeRecommand.concat(t.list),
                page: t.page + 1
            }), t.list.length < t.pagesize && (a.loaded = !0))
        })
    },
    imagesHeight: function(t) {
        var a = t.detail.width,
            e = t.detail.height,
            i = t.target.dataset.type,
            s = this;
        wx.getSystemInfo({
            success: function(t) {
                s.data.result[i] = t.windowWidth / a * e, (!s.data[i] || s.data[i] && result[i] < s.data[i]) && s.setData({
                    result: s.data.result
                })
            }
        })
    },
    bindInput: function(t) {
        this.setData({
            inputValue: t.detail.value
        })
    },
    t1: function(t) {
        n.fixedsearch(this, t)
    },
    startplay: function(t) {
        var a = t.target.dataset.cover;
        this.setData({
            cover: a,
            showvideo: !0
        }), this.videoContext = wx.createVideoContext("Video"), this.videoContext.play()
    },
    unpaidcolse: function(t) {
        var a;
        a = "open" == t.target.dataset.type, this.setData({
            unpaid: a
        })
    },
    unpaidcolse2: function(t) {
        this.setData({
            unpaidhide: !0
        })
    },
    get_nopayorder: function() {
        var a = this;
        s.get("shop/get_nopayorder", {}, function(t) {
            1 == t.hasinfo && a.setData({
                nopaygoods: t.goods,
                nopaygoodstotal: t.goodstotal,
                nopayorder: t.order,
                unpaid: !0
            })
        })
    },
    get_hasnewcoupon: function() {
        var a = this;
        s.get("shop/get_hasnewcoupon", {}, function(t) {
            1 == t.hasnewcoupon && a.setData({
                showcoupontips: !0
            })
        })
    },
    get_cpinfos: function() {
        var a = this;
        s.get("shop/get_cpinfos", {}, function(t) {
            1 == t.hascpinfos && a.setData({
                showcoupon: !0,
                cpinfos: t.cpinfos
            })
        })
    },
    adverclose: function() {
        this.setData({
            adveradmin: !1
        }), this.get_nopayorder()
    },
    indexChangebtn: function(t) {
        var a = t.currentTarget.dataset.type;
        wx.navigateTo({
            url: a
        })
    }
}, "unpaidcolse", function(t) {
    var a;
    a = "open" == t.target.dataset.type, this.setData({
        unpaid: a
    })
}), t(e, "unpaidcolse2", function(t) {
    this.setData({
        unpaidhide: !0
    })
}), t(e, "selectPicker", function(a) {
    i.checkAuth();
    var e = this;
    wx.getSetting({
        success: function(t) {
            t.authSetting["scope.userInfo"] && (d.selectpicker(a, e, "goodslist"), e.setData({
                cover: "",
                showvideo: !1
            }))
        }
    })
}), t(e, "specsTap", function(t) {
    d.specsTap(t, this)
}), t(e, "emptyActive", function() {
    this.setData({
        active: "",
        slider: "out",
        tempname: "",
        specsTitle: ""
    })
}), t(e, "buyNow", function(t) {
    d.buyNow(t, this)
}), t(e, "getCart", function(t) {
    d.getCart(t, this)
}), t(e, "select", function() {
    d.select(this)
}), t(e, "inputNumber", function(t) {
    d.inputNumber(t, this)
}), t(e, "number", function(t) {
    d.number(t, this)
}), t(e, "onChange", function(t) {
    return r.onChange(this, t)
}), t(e, "DiyFormHandler", function(t) {
    return r.DiyFormHandler(this, t)
}), t(e, "selectArea", function(t) {
    return r.selectArea(this, t)
}), t(e, "bindChange", function(t) {
    return r.bindChange(this, t)
}), t(e, "onCancel", function(t) {
    return r.onCancel(this, t)
}), t(e, "onConfirm", function(t) {
    return r.onConfirm(this, t)
}), t(e, "getIndex", function(t, a) {
    return r.getIndex(t, a)
}), t(e, "changevoice", function() {
    this.data.sound ? this.setData({
        sound: !1,
        soundpic: !0
    }) : this.setData({
        sound: !0,
        soundpic: !1
    })
}), t(e, "phone", function() {
    var t = this.data.phonenumber + "";
    wx.makePhoneCall({
        phoneNumber: t
    })
}), t(e, "cancelclick", function() {
    this.setData({
        modelShow: !1
    })
}), t(e, "confirmclick", function() {
    this.setData({
        modelShow: !1
    }), wx.openSetting({
        success: function(t) {}
    })
}), t(e, "navigate", function(t) {
    var a = t.currentTarget.dataset.url,
        e = t.currentTarget.dataset.phone,
        i = t.currentTarget.dataset.appid,
        s = t.currentTarget.dataset.appurl;
    a && wx.navigateTo({
        url: a,
        fail: function(t) {
            wx.switchTab({
                url: a
            })
        }
    }), e && wx.makePhoneCall({
        phoneNumber: e
    }), i && wx.navigateToMiniProgram({
        appId: i,
        path: s
    })
}), t(e, "closecoupon", function() {
    this.setData({
        showcoupon: !1
    })
}), t(e, "closecoupontips", function() {
    this.setData({
        showcoupontips: !1
    })
}), t(e, "onReady", function(t) {}), t(e, "pauseOther", function(i) {
    var s = this;
    u.each(this.data.audiosObj, function(t, a) {
        if (t != i) {
            a.pause();
            var e = s.data.audios;
            e[t] && (e[t].status = !1, s.setData({
                audios: e
            }))
        }
    })
}), t(e, "play", function(t) {
    var r = t.target.dataset.id,
        d = this.data.audiosObj[r] || !1;
    if (!d) {
        d = wx.createInnerAudioContext("audio_" + r);
        var a = this.data.audiosObj;
        a[r] = d, this.setData({
            audiosObj: a
        })
    }
    var u = this;
    d.onPlay(function() {
        var o = setInterval(function() {
            var t = d.currentTime / d.duration * 100 + "%",
                a = Math.floor(Math.ceil(d.currentTime) / 60),
                e = (Math.ceil(d.currentTime) % 60 / 100).toFixed(2).slice(-2),
                i = Math.ceil(d.currentTime);
            a < 10 && (a = "0" + a);
            var s = a + ":" + e,
                n = u.data.audios;
            n[r].audiowidth = t, n[r].Time = o, n[r].audiotime = s, n[r].seconds = i, u.setData({
                audios: n
            })
        }, 1e3)
    });
    var e = t.currentTarget.dataset.audio,
        i = t.currentTarget.dataset.time,
        s = t.currentTarget.dataset.pausestop,
        n = t.currentTarget.dataset.loopplay;
    0 == n && d.onEnded(function(t) {
        o[r].status = !1, u.setData({
            audios: o
        })
    });
    var o = u.data.audios;
    o[r] || (o[r] = {}), d.paused && 0 == i ? (d.src = e, d.play(), 1 == n && (d.loop = !0), o[r].status = !0, u.pauseOther(r)) : d.paused && 0 < i ? (d.play(), 0 == s ? d.seek(i) : d.seek(0), o[r].status = !0, u.pauseOther(r)) : (d.pause(), o[r].status = !1), u.setData({
        audios: o
    })
}), t(e, "imagesHeight", function(t) {
    var a = t.detail.width,
        e = t.detail.height,
        i = t.target.dataset.type,
        s = this;
    wx.getSystemInfo({
        success: function(t) {
            s.data.result[i] = t.windowWidth / a * e, (!s.data[i] || s.data[i] && result[i] < s.data[i]) && s.setData({
                result: s.data.result
            })
        }
    })
}), t(e, "onHide", function() {
    this.pauseOther()
}), t(e, "onUnload", function() {
    this.pauseOther()
}), t(e, "onPullDownRefresh", function() {}), t(e, "onReachBottom", function() {}), t(e, "onShareAppMessage", function() {
    return {
        title: this.data.diypages.page.title
    }
}), t(e, "tabtopmenu", function(t) {
    var n = this,
        a = n.data.diypages,
        e = (a.items, t.currentTarget.dataset.id, t.currentTarget.dataset.url),
        o = t.currentTarget.dataset.type,
        r = n.data.topmenu,
        i = t.currentTarget.dataset.index;
    if (c = n.data.pageid, n.setData({
        topmenuindex: i
    }), "" != e && null != e) {
        if (1 == e.indexOf("pages")) {
            var d = e.lastIndexOf("="),
                c = e.substring(d + 1, e.length);
            s.get("diypage", {
                id: c
            }, function(t) {
                if (0 == t.error) {
                    var a = [];
                    for (var e in t.diypage.items) a.push(t.diypage.items[e]);
                    a.unshift(r);
                    var i = new Object;
                    for (var s in a) i[s] = a[s], "topmenu" == a[s].id && (a[s].status = o);
                    t.diypage.items = i, n.setData({
                        diypages: t.diypage,
                        topmenuDataType: ""
                    })
                }
            })
        } else s.get("diypage/getInfo", {
            dataurl: e
        }, function(i) {
            n.data.topmenu, s.get("diypage", {
                type: c
            }, function(t) {
                var a = t.diypage;
                u.each(a.items, function(t, a) {
                    if ("topmenu" == a.id) for (var e in a.status = o, a.data) e == o && (a.data[e].data = i.goods.list, i.goods.list.length <= 8 && (a.data[e].showmore = !0))
                }), 0 == t.error && n.setData({
                    diypages: t.diypage,
                    topmenuDataType: i.type
                })
            })
        });
        n.setData({
            diypages: a
        })
    }
}), t(e, "tabwidget", function(t) {
    var e = this,
        i = e.data.diypages,
        n = (i.items, t.currentTarget.dataset.id),
        a = t.currentTarget.dataset.url,
        o = t.currentTarget.dataset.type;
    "" != a && null != a && s.get("diypage/getInfo", {
        dataurl: a
    }, function(t) {
        for (var a in i.items) a == n && (i.items[a].data[o].data = t.goods.list, i.items[a].data[o].type = t.type, i.items[a].type = t.type, i.items[a].status = o, t.goods.list.length <= 8 && (i.items[a].data[o].showmore = !0), e.setData({
            diypages: i
        }))
    })
}), t(e, "getstoremore", function(t) {
    var o = this,
        r = t.currentTarget.dataset.id,
        d = o.data.diypages;
    u.each(d.items, function(t, a) {
        if (t == r) if (null == a.status || "" == a.status) {
            n = -1 != a.data[0].linkurl.indexOf("stores") ? "stores" : "goods";
            var e = a.data[0].linkurl,
                i = a.data[0].data.length;
            s.get("diypage/getInfo", {
                dataurl: e,
                num: i,
                paramsType: n
            }, function(t) {
                a.data[0].data = t.goods.list, a.data[0].data.length == t.goods.count && (a.data[0].showmore = !0), o.setData({
                    diypages: d
                })
            })
        } else {
            if (-1 != a.data[a.status].linkurl.indexOf("stores")) n = "stores";
            else var n = "goods";
            e = a.data[a.status].linkurl, i = a.data[a.status].data.length;
            s.get("diypage/getInfo", {
                dataurl: e,
                num: i,
                paramsType: n
            }, function(t) {
                a.data[a.status].data = t.goods.list, a.data[a.status].data.length == t.goods.count && (a.data[a.status].showmore = !0), o.setData({
                    diypages: d
                })
            })
        }
    })
}), e));